home *** CD-ROM | disk | FTP | other *** search
/ Revista CD Expert 8 / Revista CD Expert nº 08 CD1.iso / Utilitarios / Programacao / Pacific C for DOS / INCLUDE / DOS.H < prev    next >
C/C++ Source or Header  |  1995-03-08  |  3KB  |  117 lines

  1. /*
  2.  *    Structures for the dos interface routines:
  3.  *        intdos()
  4.  *        intdosx()
  5.  *        int86()
  6.  *        int86x()
  7.  *        segread()
  8.  *        intr()
  9.  *        driver()
  10.  *        driverx()
  11.  */
  12.  
  13. struct WORDREGS {
  14.     unsigned int ax;
  15.     unsigned int bx;
  16.     unsigned int cx;
  17.     unsigned int dx;
  18.     unsigned int si;
  19.     unsigned int di;
  20.     unsigned int cflag;
  21.     unsigned int psw;
  22. };
  23.  
  24. struct BYTEREGS {
  25.     unsigned char al, ah;
  26.     unsigned char bl, bh;
  27.     unsigned char cl, ch;
  28.     unsigned char dl, dh;
  29. };
  30.  
  31. union REGS {
  32.     struct WORDREGS x;
  33.     struct BYTEREGS h;
  34. };
  35.  
  36. struct SREGS {
  37.     unsigned int es;
  38.     unsigned int cs;
  39.     unsigned int ss;
  40.     unsigned int ds;
  41. };
  42.  
  43. struct WORDREGPACK {
  44.     unsigned int    ax;
  45.     unsigned int    bx;
  46.     unsigned int    cx;
  47.     unsigned int    dx;
  48.     unsigned int    bp;
  49.     unsigned int    si;
  50.     unsigned int    di;
  51.     unsigned int    ds;
  52.     unsigned int    es;
  53.     unsigned int    flags;
  54. };
  55.  
  56. union REGPACK {
  57.     struct WORDREGPACK    x;
  58.     struct BYTEREGS        h;
  59. };
  60.  
  61. /*    The following macros split a long pointer (large model) into
  62.  *    offset and segment parts.
  63.  */
  64.  
  65. #define FP_OFF(ptr)    ((unsigned short)(ptr))
  66. #define FP_SEG(ptr)    (((long)(far void *)(ptr)) >> 16)
  67.  
  68. /*    construct a far pointer from segment and offset */
  69.  
  70. #if    LARGE_DATA
  71. #define    FP_CONSTRUCT(seg, offs)    ((void *)(((long)(seg) << 16) + (offs)))
  72. #else
  73. #define    FP_CONSTRUCT(seg, offs)    ((far void *)(((long)(seg) << 16) + (offs)))
  74. #endif
  75.  
  76. #define    MK_FP(seg, offs)    FP_CONSTRUCT(seg, offs)
  77.  
  78. extern int    intdos(union REGS *, union REGS *);
  79. extern int    intdosx(union REGS *, union REGS *, struct SREGS *);
  80. extern int    int86x(int, union REGS *, union REGS *, struct SREGS *);
  81. extern int    int86(int, union REGS *, union REGS *);
  82. extern int    driverx(far void *, union REGS *, struct SREGS *);
  83. extern int    driver(far void *, union REGS *);
  84. extern void    intr(int, union REGPACK *);
  85. extern int    segread(struct SREGS *);
  86. extern long    msdos(int, ...);
  87. extern long    msdoscx(int, ...);
  88. typedef    int (*    __critf_)(unsigned char, unsigned char);
  89. extern __critf_    set_crithand(__critf_);
  90. extern int    isnec98(void);
  91. extern int    _dos_getftime(int, unsigned short *, unsigned short *);
  92. extern unsigned char    __in_crithand__;
  93. extern void    nosound(void);
  94. extern void    sound(unsigned int frequency);
  95.  
  96. /*
  97.  *    Byte port I/O macros
  98.  */
  99.  
  100. #define    inp(p)        (*(port unsigned char *)(p))
  101. #define    inportb(p)    (*(port unsigned char *)(p))
  102. #define    outp(p,v)    (*(port unsigned char *)(p) = (v))
  103. #define    outportb(p,v)    (*(port unsigned char *)(p) = (v))
  104.  
  105. /*
  106.  *    Word port I/O macros
  107.  */
  108.  
  109. #define    inpw(p)        (*(port unsigned short *)(p))
  110. #define    inport(p)    (*(port unsigned short *)(p))
  111. #define    outpw(p,v)    (*(port unsigned short *)(p) = (v))
  112. #define    outport(p,v)    (*(port unsigned short *)(p) = (v))
  113.  
  114. /*
  115.  *    End of DOS.H
  116.  */
  117.